package server

import (
	"fmt"
	"tcpChat/ziface"
)

type FmtRouter struct {

}

func (r *FmtRouter) PreHandle(request ziface.IRequest) {
	fmt.Printf("\nRouter Pre exec ........... \n")
}

func (r *FmtRouter) Handle(request ziface.IRequest) {
	conn := request.GetConnection() //TCP SOCKET对象

	fmt.Printf("Router exec ........... \n")

	_, err := conn.GetConnection().Write(request.GetData())
	if err != nil{
		fmt.Println("Router function error: ", err.Error())
		return
	}
}

func (r *FmtRouter) PostHandel(request ziface.IRequest) {
	fmt.Printf("Router Post exec ........... \n")
}